<?php
/**
 * This file is part of the Agora distribution. 
 * Detailed copyright and licensing information can be found
 * in the gpl-3.0.txt file which should be included in the distribution.
 * 
 * @version		$Id: 3.0.14 Olympus 2010-09-28 rammstein4o $
 * @copyright  2007 - 2010 jVitals
 * @license   GPLv3 Open Source
 * @link       http://jvitals.com
 * @since      File available since initial release
 */
defined ('IN_AGORA') or die;

class TaskController extends AgoraProfileController {
	
	function _default() {

		$topics_model = & Model::getInstance('ProfilePostsModel');
		$access_model = & Model::getInstance('AccessModel');
		$allow_forum = $access_model->getAllowedForums($this->user['id'],'read');
		
		// create pagination with respect to current page
		$per_page = intval($this->agora_user['disp_posts']) > 0 ? $this->agora_user['disp_posts'] : intval($this->agora_config['o_disp_posts_default']);
		$num_pages = ceil( $topics_model->getTopicCount($this->user['id'], $allow_forum) / $per_page);
		$this->setPagination($num_pages);
		$page = Agora::getPage($num_pages);
		
		// get posts and process then
		$posts = $topics_model->loadAll('', $per_page, $page,$this->user['id'], $allow_forum);

		$this->view->assign('topics',$posts);
	}
}

?>
